﻿@{ 
    dynamic currentUserData =ViewBag.CurrentUserData;
    string email = currentUserData.Email;
    int uid = currentUserData.Id;
}
<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">邮箱绑定</a></li>
        @*<li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>*@
    </ul>
</div>
<div class="main">
    <form method="post" id="_form" class=" form form-control-sm ui-validForm" style="max-width:720px">
        <div class="form-group">
            <label class="control-label">绑定邮箱</label>
            <div class="controls">
                <input type="text" class="form-control" name="email" id="email"  value="@email" data-validate="dataType:'email',nullMsg:'请填写绑定的邮箱!',errorMsg:'邮箱地址填写错误'" maxlength="40">
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">邮件验证码</label>
            <div class="controls">
                <div class="input-group clearfix">
                    <input type="text" id="_EmailCode" name="_EmailCode" class="form-control" maxlength="6" placeholder="点击右侧按钮获取邮件验证码" data-validate="dataType:'numeric',minLength:6,minLengthErrorMsg:'邮件验证码为6位数字！',nullMsg:'请填写邮件验证码',checkUrl:'/E/EmailCode/Validate',checkError:'邮件验证码填写错误',additionals:'#email'">
                    <span class="input-group-btn">
                        <button type="button" class="btn btn-primary ui-btn-sendCode" data-send-params="type:'email',accordingObj:'#email'">获取验证码</button>
                    </span>
                </div>
                <span class="help-block" id="_ValidateTips__EmailCode"></span>
            </div>
        </div>

        <div class="postarea">
            <div class="form-group">
                <div class="controls">
                    @Html.AntiForgeryToken()
                    <input type="hidden" id="Id" name="Id" value="@uid" />
                    <button type="button" class="btn btn-sm  btn-primary ui-pagePost" data-custom-params="url:'@Url.ActionUrl()',callBack:'PostBack'">提交</button>
                    <a href="@Url.ActionUrl("Security")" class="btn btn-sm btn-default btn-back">返回</a>
                </div>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    function PostBack() {
        Alert("邮箱绑定成功!", { icon: 1 }, function () { location.href='@Url.ActionUrl("Security")'})
    }
</script>
